import React, { Suspense } from "react"; import dynamic from "next/dynamic"; import { AboutMarkdownSection } from "../../components/AboutMarkdownSection"; import { HomeHeroCarousel } from "../../components/HomeHeroCarousel"; import { getAboutMarkdown, getFloors, getSolutions, getHero } from "../../lib/data"; // 动态导入非关键组件,优化首屏加载 const ProductCarouselSection = dynamic( () => import("../../components/ProductCarouselSection").then((mod) => ({ default: mod.ProductCarouselSection })), { ssr: true, loading: () => } ); const SolutionsCarousel = dynamic( () => import("../../components/SolutionsCarousel").then((mod) => ({ default: mod.SolutionsCarousel })), { ssr: true, loading: () => } ); export const revalidate = 300; // 加载占位符组件 function SectionSkeleton() { return (
); } export default function HomePage({ params }: { params: { locale: string } }) { const locale = params.locale; // 并行加载数据(React 会自动优化) const [floors, solutionsData, aboutMarkdown, heroData] = [ getFloors(locale), getSolutions(locale), getAboutMarkdown(locale), getHero(locale), ]; const primaryFloor = floors[0]; return (
}> {primaryFloor && ( )} }> {solutionsData?.items?.length ? ( ) : null} }>
); }